package com.qsdjf.fp.weixin.task;

import java.util.Timer;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.qsdjf.fp.weixin.cache.TokenCache;

@Repository
public class TokenTimer extends Timer {
    @Autowired
    TokenTask task;

    @PostConstruct
    public void execute() {
        task.freshToken();
        this.schedule(task, TokenCache.getExpiresIn() * 1000, TokenCache.getExpiresIn() * 1000);
    }
}
